package web;

import entity.City;
import service.CityService;
import service.impl.CityServiceImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/city")
public class CityServlet extends BaseServlet{

    private CityService cityService = new CityServiceImpl();

    private void findByPid(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        //获取pid值
        String pidStr = req.getParameter("pid");
        Integer pid = Integer.parseInt(pidStr);

        List<City> cityList = cityService.findByPid(pid);

        write2HTML(cityList,resp);
    }
}
